//---------------------------------------------------------------------------

#ifndef TDrawCheckMapH
#define TDrawCheckMapH

#include <types.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
//#include <QExtCtrls.hpp>
//#include <Graphics.hpp>

#include "TCurve.h"
#include "TProfile.h"
#include "TCut.h"
#include "TSpeedTimePosition.h"
#include "TRetarder.h"
#include "TCtrRetarder.h"
#include "TArrester.h"
#include "TTrackRetarder.h"
#include "TDxfParameter.h"


//---------------------------------------------------------------------------
;

//---------------------------------------------------------------------------
class aColors : public vector<TColor>
{
public:
	__fastcall aColors();
};


class TDrawCheckMap
{
private:
	AnsiString Ton, TotalWeight, Car, ShortTon;
	TPoint PlanBase;
	TPoint VTSBase;
	TPoint ProfileBase;

	TProfile * Profile;
	TSwitches * Switches;
	TCurves * Curves;
	TVTS * VTS;
	TCuts * Cuts;
	TResult * ResultSetting;

	TRetarders * Retarders;
	TCtrRetarders * CtrRetarders;
	TArresters * Arresters;
	TTrackRetarders *TrackRetarders;

	TMeasurementRate MeasurementRate;
	eLanguage Language;

	int PlanMiddle;
	float TimeScale;
	float VScale;
	float LengthScale;

	TCanvas *Canvas;

	unsigned short Height;
	unsigned short Width;
	int Left, Top;
	int HundredHeight;
	int TenHeight;
	unsigned short TrackNumber;
	TTracks *Tracks;

	int __fastcall CY(const int y, const TPoint Base);
	int __fastcall CX(const float XPosition);
	bool __fastcall SetScale(void);
	bool __fastcall DrawPlan(void);
	bool __fastcall DrawHump(void);
	bool __fastcall DrawCurves(void);
	bool __fastcall DrawSwitches(void);
	bool __fastcall DrawWarningMake(void);
	bool __fastcall DrawProfile(void);
   bool __fastcall DrawVTS(void);
   bool __fastcall DrawVTSBorder(void);
   bool __fastcall DrawWholeSpeed(void);
   bool __fastcall DrawWholeTime(void);    //Todo 3 -o Li Wenjian : Check this function.
   bool __fastcall DrawLengthGraduate(const int Graduate, const int GraduateHeight, const bool Show);
   bool __fastcall DrawSpeedGraduate(void);
	bool __fastcall DrawBaseRetarderPos(const float Begin, const float End, const float Speed,
	                                    const float SpeedWindage, TColor Color);
	bool __fastcall DrawRetarderPos(TRetarders * Retarders,
                                   TCtrRetarders * CtrRetarders,
                                   const TArresters * Arresters,
                                   const TTrackRetarders * TrackRetarders);
   void __fastcall DrawTime(const float Time, const float Position, const float Length);
   void __fastcall DrawSpeed(const float Speed, const float PreSpeed, const float Position, const float PrePosition);

   void __fastcall DrawCutInf(void);
	bool __fastcall ShowTrackRetarder(void);
	bool __fastcall Change(TCuts Cuts);
	bool __fastcall ReadIniFile(void);
public:
	TImage * ShowImage;
	TDxfParameter * DxfParameter;

   int SwitchWidth;
   int CurveWidth;
   int HumpWidth;
   float PlanHeight;
   float ProfileHeight;
   float MaxTime;
	float MaxSpeed;
	float ioMaxSpeed;
	float MaxLength;
	float TimeSpeedScale;

   bool __fastcall Draw(TCanvas *Canvas, const unsigned short Height, const unsigned short Width);
   bool __fastcall SetBasePoint(void);
   __fastcall TDrawCheckMap();

	bool __fastcall Initicalize(TTracks * Tracks,
										 TCuts * Cuts,
										 TRetarders * Retarders,
										 TCtrRetarders * CtrRetarders,
										 TArresters * Arresters,
										 TTrackRetarders * TrackRetarders,
										 TVTS * tVTS,
										 TResult * tResultSetting);//TImage * ShowImage);
	bool __fastcall Initicalize(TTracks * Tracks,
										 TCuts * Cuts,
										 TRetarders * Retarders,
										 TCtrRetarders * CtrRetarders,
										 TArresters * Arresters,
										 TTrackRetarders * TrackRetarders,
										 TVTS * tVTS,
										 TResult * tResultSetting,
										 TImage * Image,
										 TCanvas * AnimalCanvas,
										 const int height, const width,
										 const int left, const top,
										 const TMeasurementRate NewMeasurementRate,
										 const eLanguage InterfaceLanguage,
										 const float fMaxSpeed, const float Distance,
										 const float NewTimeSpeedScale);
	bool __fastcall Reiniticalize(TImage *Image);
	void __fastcall DrawInitAnimal(const unsigned short WhichTrack);
	bool __fastcall DrawInitMap(TCanvas *ShowCanvas,
										 const unsigned short WhichTrack);

	void __fastcall DrawTimeSpeed(const float Speed, const float PreSpeed,
											const float Time, const float Position, const float PrePosition, const float Length);
	void __fastcall MoveCuts(TCuts Cuts);
   bool __fastcall DrawCurrentVTS(void);
	bool __fastcall MoveVTS(void);
	bool __fastcall ExportCAD(const AnsiString FileName);

};

#endif
